package top.ucat.x.system.controller.management;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.ucat.box.cloud.common.result.Result;
import top.ucat.box.cloud.common.result.SystemResult;
import top.ucat.box.starter.mybatis.plus.base.beans.PageVo;
import top.ucat.box.starter.mybatis.plus.base.controller.AbstractBaseController;
import top.ucat.x.system.entity.SysMenu;
import top.ucat.x.system.entity.beans.menu.MenuTreeVo;
import top.ucat.x.system.service.management.SysMenuService;
import top.ucat.x.system.service.management.SysMenuServiceImpl;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Jun
 * @since 2019-06-06
 */
@RestController
@RequestMapping("sys/menu")
public class SysMenuController extends AbstractBaseController<SysMenu, SysMenuService> {

    @Autowired
    private SysMenuService sysMenuService;

    @GetMapping("tree")
    public Result<List<MenuTreeVo>> getAllMenuTree() {
        PageVo pageVo = new PageVo();
        List<MenuTreeVo> allMenuTree = sysMenuService.getAllMenuTrees();
        pageVo.setData(allMenuTree);
        return SystemResult.OK.getResult(pageVo);
    }

}

